package ch.mueller.android.nmeaexample.util.readerFactoryElements;

import java.util.LinkedHashMap;

public class GGAAnalyser extends GPSLineAnalyser {

    public GGAAnalyser(String line) {
        super(line);
    }

    @Override
    public LinkedHashMap<String, String> getResult() {
        LinkedHashMap<String, String> element = new LinkedHashMap<String, String>();
        int i = 0;
        String[] splitts = line.split(",");
        element.put("TYPE", getValue(splitts, i++));
        element.put("UTC Time", UTCtimeCheck(getValue(splitts, i++)));
        element.put("Latitude", getValue(splitts, i++));
        element.put("N/SIndicator", nsCkeck(getValue(splitts, i++)));
        element.put("Longitude", getValue(splitts, i++));
        element.put("E/W Indicator", owCkeck(getValue(splitts, i++)));
        element.put("PositionFixIndicator", getValue(splitts, i++));
        element.put("Satalites Used", rangeCheck(getValue(splitts, i++), 0, 12));
        element.put("HDOP", getValue(splitts, i++));
        element.put("MSL Altitude", getValue(splitts, i++));
        element.put("Units0", getValue(splitts, i++));
        element.put("GeoidSeparation", getValue(splitts, i++));
        element.put("Units1", getValue(splitts, i++));
        element.put("Age of diff. Corr", getValue(splitts, i++));
        element.put("Diff ref Stadiation", getValue(splitts, i++));
        element.put(CHECKSUM, calculateCheksum(line));

        return element;
    }

}
